package com.todo.common.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author zhangwenxiang
 * @date 2024/4/7 20:32
 * @description
 */
@Getter
@AllArgsConstructor
public enum GenderEnum {

    MALE(0,"MALE", "男"),
    FEMALE(1,"FEMALE", "女"),
    UNKNOWN(-1,"UNKNOWN", "未知"),
    ;

    private static Map<Integer, GenderEnum> enumMap = Arrays.stream(GenderEnum.values()).collect(Collectors.toMap(GenderEnum::getType, e -> e));

    private Integer type;
    /**
     * 场景code
     */
    private String code;
    /**
     * 场景描述
     */
    private String desc;


    public static GenderEnum getGenderEnumByType(Integer type){
        if (type == null){
            return null;
        }
        return enumMap.get(type);
    }
}
